﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class OneEventPanel : EventPanel
{
    public CanvasGroup cg;
    public CanvasGroup hand1;
    public Text optionText1;

    public override void OnEnter()
    {
        cg.blocksRaycasts = true;
        cg.interactable = true;
        cg.alpha = 1;
        activated = true;
        hand1.alpha = 1;
        optionText1.text = optionNames[0];
        GameManager.Instance.ChangeState(StateOP.Push, GameState.Event);
        Texture2D tex = Resources.Load(imagePath) as Texture2D;
        image.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
        Input.ResetInputAxes();
    }

    public override void OnExit()
    {
        cg.blocksRaycasts = false;
        cg.interactable = false;
        cg.alpha = 0;
        activated = false;
        GameManager.Instance.ChangeState(StateOP.Pop);
    }

    public override void OnPause()
    {
        cg.blocksRaycasts = false;
        cg.interactable = false;
        cg.alpha = 0;
        activated = false;
    }

    public override void OnResume()
    {
        cg.blocksRaycasts = true;
        cg.interactable = true;
        cg.alpha = 1;
        activated = true;
        hand1.alpha = 1;
        GameManager.Instance.ChangeState(StateOP.Push, GameState.Event);
        Input.ResetInputAxes();
    }

    void Start()
    {

    }

    void Update()
    {
        if (activated)
        {
            if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButton(0))
            {
                gotoOption(0);
            }
        }
    }
}
